Avorion Script API Documentation

Player Callbacks

Note: Callbacks have to be buffered in certain situations and won't happen immediately. When unregistering a callback during a callback, all callbacks that were buffered during the last frame may still be sent, even though they were unregistered.

callback onChatMessage(playerIndex, text, channel)

Executed whenever the player sent a chat message to the server. Only called if the chat message is valid and the player doesn't have a chat ban.

Parameters

playerIndex Index of the player
text The text content of the chat message
channel The channel the message was sent to. 0 = All, 1 = Sector, 2 = Group, 3 = Alliance

callback onGalaxyMapMouseUp(button, mx, my, cx, cy, mapMoved)

Executed whenever on the galaxy map a mouse-up event occurs.

Parameters

button The button that was released
mx The mouse X position
my The mouse Y position
cx The coordinates X position
cy The coordinates Y position
mapMoved True if the map was moved during the mouse pressing

callback onItemAdded(playerIndex, amount, amountBefore)

Executed whenever the number of items in a particular item slot in the player's inventory increases or a new item was added.

Parameters

playerIndex Index of the item
amount The new amount of this item
amountBefore The amount of this item before the change

callback onItemChanged(playerIndex, amount, amountBefore)

Executed whenever the number of items in a particular item slot in the player's inventory changes.

Parameters

playerIndex Index of the player
amount The new amount of this item
amountBefore The amount of this item before the change

callback onItemRemoved(playerIndex, amount, amountBefore)

Executed whenever the number of items in a particular item slot in the player's inventory decreases or the item was removed.

Parameters

playerIndex Index of the player
amount The new amount of this item
amountBefore The amount of this item before the change

callback onMailCleared(playerIndex, mailIndex)

Executed whenever the player takes the contents of a mail

Parameters

playerIndex Index of the player
mailIndex Index of the cleared mail

callback onMailDeleted(playerIndex)

Executed whenever the player deletes a mail

Parameters

playerIndex Index of the player

callback onMailRead(playerIndex, mailIndex)

Executed whenever the player reads a mail

Parameters

playerIndex Index of the player
mailIndex Index of the read mail

callback onMailReceived(playerIndex, index)

Executed whenever the player receives a new mail

Parameters

playerIndex Index of the player
index Index of the received mail

callback onMoveToReconstructionSite(playerIndex)

Executed whenever a move to reconstruction site is triggered because the player was destroyed. Called even if the player is already at his reconstruction site.

Parameters

playerIndex Index of the player

callback onRelationLevelChanged(playerIndex, factionIndex, relations)

Executed whenever the relations of the player to another faction changes.

Parameters

playerIndex Index of the player
factionIndex Index of the other faction
relations The new relations of the player to the other faction

callback onRelationStatusChanged(playerIndex, factionIndex, status)

Executed whenever the relation status of the player to another faction changes.

Parameters

playerIndex Index of the player
factionIndex Index of the other faction
status The new relation status of the player to the other faction

callback onResourcesChanged(playerIndex)

Executed whenever the money or resources of the player change

Parameters

playerIndex Index of the player

callback onResourcesChanged(playerIndex)

Executed whenever the money or resources of the player change

Parameters

playerIndex Index of the player

callback onSectorEntered(playerIndex, x, y, sectorChangeType)

Executed whenever the player enters a new sector.

Parameters

playerIndex Index of the player
x The x coordinates of the sector entered
y The y coordinates of the sector entered
sectorChangeType The kind of sector change that is happening

callback onSectorLeft(playerIndex, x, y, sectorChangeType)

Executed whenever the player leaves his current sector.

Parameters

playerIndex Index of the player
x The x coordinates of the sector left
y The y coordinates of the sector left
sectorChangeType The kind of sector change that is happening

callback onShipChanged(playerIndex, craftId)

Executed whenever the player changes the ship he is currently flying

Parameters

playerIndex Index of the player
craftId The id of the new craft he is flying

callback onStartDialog(objectIndex)

Executed when a dialog is started.

Parameters

objectIndex The index of the entity the dialog is started with

Overview
Home Functions Search
Search:

This is the official documentation for the scripting API of Avorion. This documentation is automatically generated and not necessarily complete. Depending on the context in which functions exist, some documentation such as descriptions, return values or variable names or types may be missing.

Work in Progress. Documentation of Avorion Version: 1.0 r22021 59065310fc1a